Linux CLI 101

Written by Ken Gypen

September 6, 2007 | 09:53

Tags: #cli

System Commands 102

While (h)top will show you a lot of information on your system, there's a lot more that can be made visible. This is especially true for listing installed hardware. Lots of people complain about unsupported hardware, and in this chapter I'll point you to some tools that aid your search for that one module ( you Windows folk will call it a driver) that makes it all work.

Our first and most important tool is “lspci”. By issuing lspci, you get a list of all devices on the PCI bus. When even more detailed information is needed, add the '-v' or '-vv' switch to the command.

Not only is this handy for seeing what is installed, it's great for seeing what's not installed correctly. When you see “Unknown hardware” you know what device you should focus on.

Likewise “lsusb” lists the attached USB devices. It too has the “-v” switch that gives a lot more information. I attached my USB drive to the virtual system and it got picked up without a hitch.

Linux CLI 101 Some little extras... Linux CLI 101 Some little extras...

In the case of a non-functioning piece of hardware, you should always start with “lspci” or "lsusb". If it's listed there, you can start an online hunt for the required module. Modules in Linux are comparable to the Windows drivers.

To see what modules are loaded, we use the command “lsmod”. Issuing lsmod will not only show you what modules are loaded but also what is using them, along with the size of the module. Once your module hunt is successful and you've either obtained or compiled your module, you can load it with “modprobe”. If you wish to remove a module (sometimes required when updating or troubleshooting), you can use “rmmod”.

Note the similarity to the file commands - ls, rm...these types of recurring commands mean you don't have to think so hard about each one. If you need a list, odds are the command starts with ls.

Linux CLI 101 Some little extras...

Even more help

I won't deny that learning is hard, especially in the darkness of a terminal where you could be eaten by a Grue at any moment, but Linux has a great help system built in, named manpages. Manpages offer detailed help on almost all commands that can be run on the system.

A simple “man <command>” will pull out the desired page. Ironically, man man opens the info on how to use the info pages. There's also the “info” command to aid you out. It's like the “man” command, but not used as frequently.

A light at the end of the terminal...

This concludes my short intro into the CLI world. It's nowhere near complete, but if you familiarise yourself with these commands, you can stand your ground on any 'Nix based system.

Of course, Rome wasn't built in a day - learning the CLI is like learning a GUI all over again. You need to find out tricks on how to do things, get comfortable with switches...and if you're done doing that, there's even more to discover on the scripting side of things. If you get to the point where you can write a (BASH) script for 90% of your daily tasks, you know you have mastered the command line interface, and you just climbed a fair deal on the geek ladder.

In the meantime, I hope this will be a good start to get you on the way there.
Discuss this in the forums
YouTube logo
MSI MPG Velox 100R Chassis Review

October 14 2021 | 15:04

TOP STORIES

SUGGESTED FOR YOU